package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.ICabinetConfigDao;
import org.jsbd.boss.domian.CabinetConfigBean;
import org.springframework.stereotype.Repository;

import edu.hziee.common.dbroute.BaseDAO;


@Repository("cabinetConfigDao")
public class CabinetConfigDaoImpl extends BaseDAO implements ICabinetConfigDao {

	@Override
	public void saveCabinetConfig(CabinetConfigBean cabinetConfig) {
		super.insert("qy_channel_cabinet_config.insert_qy_channel_cabinet_config", cabinetConfig);
	}

	@Override
	public void updateCabinetConfig(CabinetConfigBean cabinetConfig) {
		super.insert("qy_channel_cabinet_config.update_qy_channel_cabinet_config", cabinetConfig);
	}

	@Override
	public CabinetConfigBean getCabinetConfig(CabinetConfigBean cabinetConfig) {
		return (CabinetConfigBean) super.queryForObject("qy_channel_cabinet_config.select_qy_channel_cabinet_config_one", cabinetConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<CabinetConfigBean> getCabinetConfigList(CabinetConfigBean cabinetConfig) {
		return super.queryForList("qy_channel_cabinet_config.select_qy_channel_cabinet_config_list", cabinetConfig);
	}

	@Override
	public Map<String, Object> getCabinetConfigListPage(DataGridModel page, CabinetConfigBean form) {
		form = (form == null ? new CabinetConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("qy_channel_cabinet_config.select_qy_channel_cabinet_config_page_count", form));
		results.put("rows", super.queryForList("qy_channel_cabinet_config.select_qy_channel_cabinet_config_list", form));
		return results;
	}

	@Override
	public Integer getCabinetConfigCount(CabinetConfigBean cabinetConfig) {
		return super.queryForCount("qy_channel_cabinet_config.select_qy_channel_cabinet_config_page_count", cabinetConfig);
	}

	public void deleteCabinetConfig(CabinetConfigBean cabinetConfig){
		super.update("qy_channel_cabinet_config.del_qy_channel_cabinet_config", cabinetConfig);
	}
	
	@Override
	public List<CabinetConfigBean> validateCabinetConfig(CabinetConfigBean cabinetConfig) {
		return super.queryForList("qy_channel_cabinet_config.select_qy_channel_cabinet_validate_list", cabinetConfig);
	}
	
	
}
